home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-03 | 3.8 KB | 138 lines | [TEXT/MPS ] |
- //----------------------------------------------------------------------------------------
- // UDemoText.cp
- // Copyright © 1986-96 by Apple Computer, Inc. All rights reserved.
- //----------------------------------------------------------------------------------------
-
- #ifndef __UDEMOTEXT__
- #include "UDemoText.h"
- #endif
-
- // DemoText
-
- #ifndef __USCRIPTMENU__
- #include "UScriptMenu.h"
- #endif
-
- // MacApp
-
- #ifndef __UMACAPPGLOBALS__
- #include "UMacAppGlobals.h"
- #endif
-
- #ifndef __UMACAPPUTILITIES__
- #include "UMacAppUtilities.h"
- #endif
-
- #ifndef __UMENUMGR__
- #include "UMenuMgr.h"
- #endif
-
- #ifndef __UOSASCRIPT__
- #include "UOSAScript.h"
- #endif
-
- #ifndef __UVIEWSERVER__
- #include "UViewServer.h"
- #endif
-
- #ifndef __UVIEW__
- #include "UView.h"
- #endif
-
- // Toolbox
-
- #ifndef __FONTS__
- #include <Fonts.h>
- #endif
-
- //========================================================================================
- // CLASS TDemoTextApplication
- //========================================================================================
- #undef Inherited
-
- #if qPowerTalk
- #define Inherited TMailingApplication
- #else
- #define Inherited TApplication
- #endif
-
- #pragma segment AInit
- MA_DEFINE_CLASS_M1(TDemoTextApplication, Inherited);
-
- //----------------------------------------------------------------------------------------
- // TDemoTextApplication destructor
- //----------------------------------------------------------------------------------------
- #pragma segment MADestructorRes
-
- TDemoTextApplication::~TDemoTextApplication()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // TDemoTextApplication::IDemoTextApplication:
- //----------------------------------------------------------------------------------------
- #pragma segment AInit
-
- void TDemoTextApplication::IDemoTextApplication(void)
- {
- CStr255 fontName;
- TTEView* aTEView;
-
- #if qPowerTalk
- this->IMailingApplication(kFileType, kStandardLetterFileType, kSignature);
- #else
- this->IApplication(kFileType, kSignature);
- #endif
-
- AppendResMenu(MAGetMenu(mFont), 'FONT');
-
- SetStyle(cBold, bold);
- SetStyle(cUnderline, underline);
- SetStyle(cItalic, italic);
- SetStyle(cOutline, outline);
- SetStyle(cShadow, shadow);
- SetStyle(cCondense, condense);
- SetStyle(cExtend, extend);
-
- // Instead of hard-wiring a default text style, get it from the TEView resource
- FailNIL(aTEView = (TTEView*)gViewServer->DoCreateViews(NULL, NULL, kViewRsrcID, gZeroVPt));
- GetFontName(aTEView->fTextStyle.tsFont, fontName);
-
- // Set up initial text specs
- TTEDocument::gDefaultSpecs.theTextFont = fontName;
- TTEDocument::gDefaultSpecs.theTextFace = aTEView->fTextStyle.tsFace;
- TTEDocument::gDefaultSpecs.theTextSize = aTEView->fTextStyle.tsSize;
- TTEDocument::gDefaultSpecs.theTextColor = aTEView->fTextStyle.tsColor;
- TTEDocument::gDefaultSpecs.theJustification = aTEView->fJustification;
- TTEDocument::gDefaultSpecs.theBackColor = gRGBWhite;
- aTEView = (TTEView*)FreeIfObject(aTEView);
-
- TScriptMenuBehavior* theScriptMenu = new TScriptMenuBehavior;
- theScriptMenu->IScriptMenuBehavior();
- this->AddBehavior(theScriptMenu);
-
- #if qAttachable
- if (fOSAScript != NULL)
- fOSAScript->fNextScriptIdle = 0;
- #endif
-
- } // TDemoTextApplication::IDemoTextApplication
-
- //----------------------------------------------------------------------------------------
- // TDemoTextApplication::DoMakeDocument:
- //----------------------------------------------------------------------------------------
- #pragma segment AOpen
-
- TDocument* TDemoTextApplication::DoMakeDocument(CommandNumber /* itsCommandNumber */, TFile* itsFile) // override
- {
- TTEDocument* aTEDocument = new TTEDocument;
-
- aTEDocument->ITEDocument(itsFile, kFileType, kWindowRsrcID);
- return aTEDocument;
- } // TDemoTextApplication::DoMakeDocument
-
- //----------------------------------------------------------------------------------------
- // End of UDemoText.cp
-
- #pragma segment Inline
-